const action_fapiao_wkf = {
  _odoo_model: 'ir.actions',
  name: 'fapiao workflow',
  type: 'ir.actions.act_window',
  res_model: 'fp.fapiao.wkf.wizard',
  domain: [],
  context: {
    active_model: 'fp.fapiao'
  }
}

const form_fapiao_wkf_wizard = {
  _odoo_model: 'ir.ui.view',
  model: 'fp.fapiao.wkf.wizard',
  type: 'form',

  fields: {
    fapiao_out_invoice_ids: {
      string: '发票',
      widget: 'x2many_tree',
      readonly2: 1,
      views: {
        tree: {
          fields: {
            invoice_type: {},

            name: {},
            state: {},
            api_state: {},
            fapiao_serial_num: {},
            api_status: {},

            type_code: {},
            code: {},
            date_fapiao: {},

            // amount_untaxed: {},
            amount_tax: {},
            amount_total: {}
          }
        },
        form: {
          fields: {
            invoice_type: {},

            name: {},
            state: {},
            api_state: {},
            fapiao_serial_num: {},
            api_status: {},

            type_code: {},
            code: {},
            date_fapiao: {},

            // amount_untaxed: {},
            amount_tax: {},
            amount_total: {}
          }
        }
      }
    }
  }
}

export default {
  form_fapiao_wkf_wizard_confirm: {
    ...form_fapiao_wkf_wizard,
    arch: {
      buttons: [
        {
          name: 'action_confirm',
          string: '确认发票',
          type: 'object',
          btn_type: 'primary'
        }
      ]
    }
  },

  form_fapiao_wkf_wizard_request: {
    ...form_fapiao_wkf_wizard,
    arch: {
      buttons: [
        {
          name: 'action_request',
          string: '开票',
          type: 'object',
          btn_type: 'primary'
        }
      ]
    }
  },

  form_fapiao_wkf_wizard_request_read: {
    ...form_fapiao_wkf_wizard,
    arch: {
      buttons: [
        {
          name: 'action_request_read',
          string: '开票查询',
          type: 'object',
          btn_type: 'primary'
        }
      ]
    }
  },

  form_fapiao_wkf_wizard_send_result: {
    ...form_fapiao_wkf_wizard,
    arch: {
      buttons: [
        {
          name: 'action_send_result',
          string: '回写结果',
          type: 'object',
          btn_type: 'primary'
        }
      ]
    }
  },

  action_fapiao_confirm: {
    ...action_fapiao_wkf,
    name: '确认发票',
    views: {
      form: 'form_fapiao_wkf_wizard_confirm'
    }
  },

  action_fapiao_request: {
    ...action_fapiao_wkf,
    name: '开票',
    views: {
      form: 'form_fapiao_wkf_wizard_request'
    }
  },

  action_fapiao_request_read: {
    ...action_fapiao_wkf,
    name: '开票查询',
    views: {
      form: 'form_fapiao_wkf_wizard_request_read'
    }
  },

  action_fapiao_send_result: {
    ...action_fapiao_wkf,
    name: '回写结果',
    views: {
      form: 'form_fapiao_wkf_wizard_send_result'
    }
  }
}
